<?php


namespace app\manage\model;


use think\Model;
use traits\model\SoftDelete;

class BaseModel extends Model
{
    use SoftDelete;

    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';
    protected $deleteTime = 'delete_time';
    protected $autoWriteTimestamp = true;

    protected function basePaginate($pageSize=null, $config=[])
    {
        return self::paginate($pageSize, false, $config);
    }

//    public function delete(){
////        self::where('id', '=', $this->id)->update(['delete_time' => time()]);
//        self::update(['id'=> $this->id, 'status' =>0]);
//    }

    protected function img_prefix($value, $data)
    {
        $temp = $value;
        if ($data['from'] == 1) {
            $temp = config('setting.img_prefix') . $value;
        }
        return $temp;
    }
}